from flask_restful import fields
from flask_restful_swagger import swagger

@swagger.model
class BookModel(object):

    book_fields = {
        'id': fields.Integer,
        'name': fields.String,
        'price': fields.Float(default=10),
        'author': fields.String
    }

    book_list_fields = {
        'total': fields.Integer(default=10),
        'data': fields.List(fields.Nested({
            'id': fields.Integer,
            'name': fields.String,
            'price': fields.Float(default=10),
            'author': fields.String
        }))
    }

    def __init__(self, name, author, price):
        self.name = name
        self.author = author
        self.price = price

